package com.arges.pojo;

/**
 * 结果返回集对象
 */
public class Result {
    /**
     * 标记 响应成功/失败
     */
    private boolean flag;
    /**
     * 消息提示
     */
    private String msg;
    /**
     * 返回数据
     */
    private Object data;

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 响应失败结果
     * @param msg
     * @return
     */
    public static Result error(String msg){
        Result result = new Result();
        result.flag=false;
        result.msg=msg;
        return result;
    }

    /**
     * 响应成功，并且有数据的
     * @param data
     * @return
     */
    public static Result success(Object data){
        Result result = new Result();
        result.flag=true;
        result.data=data;
        return result;
    }

    /**
     * 响应成功结果 没有数据的 增删改
     * @return
     */
    public static Result success(){
        Result result = new Result();
        result.flag=true;
        return result;
    }

}
